<template>
  <a-table
    :columns="columns"
    :data-source="tableData"
    :loading="loading"
    :pagination="pagination"
    @change="handleTableChange"
    :rowKey="(record, index) => record.id"
    bordered
  >
    <template slot="shelfName" slot-scope="text">
      <div style="text-align:left" v-if="text.length > 0">
        <div v-for="(item, index) in text" :key="index">
          {{ item }}
        </div>
      </div>
      <div v-else style="color:#c7254e">
        无库存
      </div>
    </template>
  </a-table>
</template>

<script>
import { IssueColumns } from "./tableConfig";
import { tableMinxins } from "@/unit/mixins/tableMinxins.js";
import api from "@/api/apiServer";
export default {
  mixins: [tableMinxins],
  data() {
    return {
      columns: IssueColumns,
    };
  },
  methods: {
    // 获取列表数据
    async getList(arg) {
      //加载数据 若传入参数1则加载第一页的内容
      if (arg === 1) {
        this.pagination.current = 1;
      }
      var params = this.getQueryParams();
      const res = await api.DepartmentList(params);
      this.tableData = res.data.data;
      this.pagination.total = res.data.total;
    },
  },
};
</script>
